package com.FindMyStuff.Model;

public enum UserStatus {
	Locked("l"), Unlocked("u");
	
	/**
	 * Holds the Enum Value
	 */
	private String value;
	
	/**
	 * Private Constructor to store the enum value
	 * @param string
	 */
	private UserStatus(String string)
	{
		value = string;
	}
	
	/**
	 * Creates a String of the enum 
	 */
	public String toString() {
		String res = "";
	       switch (this) {
	         case Locked:
	        	 res = value;
	        	 break;
	         case Unlocked:
	        	 res = value;
	        	 break;
	        }
		return res;
	 }
	
	/**
	 * Converts string into an enum 
	 * @param string value to convert
	 * @return converted enum
	 */
	public static UserStatus convertToStatus(String string)
	{
		if(string.equals("l"))
		{
			return Locked;
		}
		else 
		{
			return Unlocked;
		}
		
	}

	/**
	 * Translate the enum into boolean values
	 * @return boolean values
	 */
	public boolean toBool() {
		boolean res = false;
	       switch (this) {
	         case Locked:
	        	 res = true;
	        	 break;
	         case Unlocked:
	        	 res = false;
	        	 break;
	        }
		return res;
	 }
}
